/**
 *	flowunit流程模块接口
 *	开发者：雨中磐石
 *	地址：www.rockoa.com
 *	日期：2023-07-31
 */

package com.framework.Module.flow.flowunit;




import com.framerock.baselib.Rock;
import com.framework.ACore.Model;
import com.framework.Flow.FlowListener;
import com.framework.Model.ModelMode;


import java.util.Map;

public class FlowListenerflowunit extends FlowListener {


    public Boolean onModejs() {
        return true;
    }

    @Override
    public Boolean onRemind() { return false; }

    @Override
    public Map<String, String> onReplacers(Map<String, String> da, int lx) {
        String str;
        str = Rock.getMapString(da, "recename");
        if(Rock.isEmpt(str))da.put("recename", "全部人员");
        return super.onReplacers(da, lx);
    }

    @Override
    public Map<String, String> onSavebefore(Map<String, String> da, String mid, Boolean isadd) {
        Map<String, String> bda = Rock.getMap(),ors,mrs;
        String msg = "";
        if(!isadd  && Rock.getMapint(da, "isflow") > 0){
            ors = mFlow.mModel.getOne(mid);
            if(ors != null){
                String mknum = Rock.getMapString(ors, "mknum");
                if(!Rock.isEmpt(mknum)){
                    mrs = ModelMode.get(this.nDb).getOne("`num`='"+mknum+"'");
                    int islc = Rock.getMapint(mrs, "islc");
                    if(islc != 1)msg = "此模块不能开启流程";
                }
            }
        }
        bda.put("msg", msg);
        return bda;
    }
}
